meta %>%
filter(su_tract == 1) %>%
select(description) %>% as.list()
## $description
## [1] "# of low-wage jobs in the su (earnings $1250/month or less )"
## [2] "# of mid-wage jobs in the su (earnings $1251/month to $3333/month)"
## [3] "# of high-wage jobs in the su (earnings greater than $3333/month)"
## [4] "Total # of jobs in the su"
## [5] "Total # of workers who live in the su"
## [6] "Total # of workers who live in the su divided by the total # of jobs in the su"
## [7] "# of low-wage jobs in the su divided by the total # of jobs in the su"
## [8] "# of mid-wage jobs in the su divided by the total # of jobs in the su"
## [9] "# of high-wage jobs in the su divided by the total # of jobs in the su"
## [10] "# of White alone workers employed in the su"
## [11] "# of Black alone workers employed in the su"
## [12] "# of American Indian or Alaska Native alone workers employed in the su"
## [13] "# of Asian alone workers employed in the su"
## [14] "# of Native Hawaiian or Other Pacific Islander alone workers employed in the su"
## [15] "# of workers employed in the su who identify as two or more race groups"
## [16] "# of jobs for workers with less than a high school education"
## [17] "# of jobs for workers with a high school educaiton but no college"
## [18] "# of jobs for workers with some college or an Associates degree"
## [19] "# of jobs for workers with a Bachelor's or advanced degree"
## [20] "5-digit county code"
## [21] "11-digit census tract code"
## [22] "County name"
glimpse(lodes)
## Rows: 50
## Columns: 20
## $ w_tract <dbl> 51003010100, 51003010201, 51003010202, 510030…
## $ lowwage_jobs <int> 174, 166, 70, 696, 246, 370, 1408, 1865, 74, …
## $ midwage_jobs <int> 204, 250, 136, 1074, 337, 512, 2415, 1463, 14…
## $ higwage_jobs <int> 156, 439, 147, 1996, 511, 399, 3618, 1434, 13…
## $ alljobs <int> 534, 855, 353, 3766, 1094, 1281, 7441, 4762, …
## $ lowwage_p <dbl> 0.3258427, 0.1941520, 0.1983003, 0.1848115, 0…
## $ midwage_p <dbl> 0.3820225, 0.2923977, 0.3852691, 0.2851832, 0…
## $ higwage_p <dbl> 0.2921348, 0.5134503, 0.4164306, 0.5300053, 0…
## $ White_workers <int> 481, 612, 303, 3076, 873, 1030, 5730, 3550, 3…
## $ Black_workers <int> 36, 170, 36, 455, 174, 201, 1384, 933, 29, 20…
## $ AI_Na_workers <int> 1, 1, 2, 7, 2, 1, 16, 13, 0, 42, 8, 2, 1, 0, …
## $ Asian_workers <int> 11, 51, 4, 176, 32, 22, 194, 162, 8, 1204, 13…
## $ NaH_PI_workers <int> 1, 3, 2, 0, 0, 0, 4, 4, 1, 11, 3, 0, 0, 0, 3,…
## $ Multiracial_workers <int> 4, 18, 6, 52, 13, 27, 113, 100, 4, 284, 69, 2…
## $ lessThanHS_jobs <int> 62, 76, 42, 294, 112, 115, 551, 379, 29, 985,…
## $ HSnoCollege_jobs <int> 124, 206, 75, 714, 259, 257, 1490, 881, 91, 2…
## $ SomeColl_Associates_jobs <int> 134, 204, 100, 866, 301, 273, 1904, 1112, 77,…
## $ Bach_AdvDeg_jobs <int> 95, 180, 71, 991, 223, 232, 2060, 1018, 108, …
## $ w_county <int> 51003, 51003, 51003, 51003, 51003, 51003, 510…
## $ countyName <chr> "Albemarle", "Albemarle", "Albemarle", "Albem…
lodes %>% select(lowwage_jobs:Bach_AdvDeg_jobs) %>%
select(where(~is.numeric(.x))) %>%
as.data.frame() %>%
stargazer(., type = "text", title = "Summary Statistics", digits = 2,
summary.stat = c("mean", "sd", "min", "median", "max"))
##
## Summary Statistics
## =============================================================
## Statistic Mean St. Dev. Min Median Max
## -------------------------------------------------------------
## lowwage_jobs 543.86 635.56 39 330 3,119
## midwage_jobs 739.48 845.16 67 465.5 4,217
## higwage_jobs 1,074.18 1,946.89 57 427 10,800
## alljobs 2,357.52 3,302.36 219 1,237 17,152
## lowwage_p 0.27 0.10 0.08 0.26 0.51
## midwage_p 0.35 0.07 0.15 0.35 0.51
## higwage_p 0.38 0.12 0.17 0.37 0.74
## White_workers 1,853.80 2,606.83 134 1,047 13,579
## Black_workers 366.04 470.65 25 172 2,104
## AI_Na_workers 7.06 8.37 0 5 42
## Asian_workers 88.76 190.06 2 28 1,204
## NaH_PI_workers 1.62 2.48 0 1 11
## Multiracial_workers 40.24 58.26 3 19.5 284
## lessThanHS_jobs 198.24 225.05 22 114.5 1,193
## HSnoCollege_jobs 467.00 549.46 54 288 2,723
## SomeColl_Associates_jobs 539.94 751.68 43 296 3,675
## Bach_AdvDeg_jobs 613.36 1,131.29 31 285.5 6,590
## -------------------------------------------------------------
loch_missingness_monster(lodes)
## There are 0 missing values in the dataset
## The maximum number of values that any variable is missing is 0
##
## Number of missing values per variable:
## w_tract lowwage_jobs midwage_jobs higwage_jobs alljobs lowwage_p midwage_p
## 0 0 0 0 0 0 0
## higwage_p White_workers Black_workers AI_Na_workers Asian_workers
## 0 0 0 0 0
## NaH_PI_workers Multiracial_workers lessThanHS_jobs HSnoCollege_jobs
## 0 0 0 0
## SomeColl_Associates_jobs Bach_AdvDeg_jobs w_county countyName
## 0 0 0 0
lodes %>% select(c(w_tract:alljobs)) %>%
pivot_longer(-w_tract, names_to = "measure", values_to = "value") %>%
ggplot(aes(x = value, fill = measure)) +
scale_fill_viridis(option = "plasma", discrete = TRUE, guide = FALSE) +
geom_histogram() +
facet_wrap(~measure, scales = "free")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## [1] TRUE
pal <- colorNumeric("plasma", reverse = TRUE, domain = cvl_lodes$alljobs)
leaflet(cvl_lodes) %>%
addProviderTiles("CartoDB.Positron") %>%
addPolygons(data = cvl_lodes,
fillColor = ~pal(alljobs),
weight = 1,
opacity = 1,
color = "white",
fillOpacity = 0.6,
highlight = highlightOptions(
weight = 1, fillOpacity = 0.8, bringToFront = T
),
popup = paste0("Block Group: ", cvl_lodes$BLKGRPCE, "<br>",
"Number of jobs: ", cvl_lodes$alljobs, 2)) %>%
addLegend("bottomright", pal = pal, values = cvl_lodes$alljobs,
title = "Number of jobs", opacity = 0.7)
pal <- colorNumeric("plasma", reverse = TRUE, domain = cvl_lodes$lowwage_p)
leaflet(cvl_lodes) %>%
addProviderTiles("CartoDB.Positron") %>%
addPolygons(data = cvl_lodes,
fillColor = ~pal(lowwage_p),
weight = 1,
opacity = 1,
color = "white",
fillOpacity = 0.6,
highlight = highlightOptions(
weight = 1, fillOpacity = 0.8, bringToFront = T
),
popup = paste0("Block Group: ", cvl_lodes$BLKGRPCE, "<br>",
"Prop. low-wage jobs: ", round(cvl_lodes$lowwage_p, 2))) %>%
addLegend("bottomright", pal = pal, values = cvl_lodes$lowwage_p,
title = "Proportion of low wage jobs", opacity = 0.7)
# High wage jobs
pal <- colorNumeric("plasma", reverse = TRUE, domain = cvl_lodes$higwage_p)
leaflet(cvl_lodes) %>%
addProviderTiles("CartoDB.Positron") %>%
addPolygons(data = cvl_lodes,
fillColor = ~pal(higwage_p),
weight = 1,
opacity = 1,
color = "white",
fillOpacity = 0.6,
smoothFactor = 0.3,
highlight = highlightOptions(
weight = 1, fillOpacity = 0.8, bringToFront = T
),
popup = paste0("Block Group: ", cvl_lodes$BLKGRPCE, "<br>",
"Prop. high-wage jobs: ", round(cvl_lodes$higwage_p, 2))) %>%
addLegend("bottomright", pal = pal, values = cvl_lodes$higwage_p,
title = "Proportion of high-wage jobs", opacity = 0.7)
pal <- colorNumeric("plasma", reverse = TRUE, domain = cvl_lodes$Bach_AdvDeg_jobs)
leaflet(cvl_lodes) %>%
addProviderTiles("CartoDB.Positron") %>%
addPolygons(data = cvl_lodes,
fillColor = ~pal(Bach_AdvDeg_jobs),
weight = 1,
opacity = 1,
color = "white",
fillOpacity = 0.6,
smoothFactor = 0.3,
highlight = highlightOptions(
weight = 1, fillOpacity = 0.8, bringToFront = T
),
popup = paste0("Block Group: ", cvl_lodes$BLKGRPCE, "<br>",
"Number of jobs: ", cvl_lodes$Bach_AdvDeg_jobs)) %>%
addLegend("bottomright", pal = pal, values = cvl_lodes$Bach_AdvDeg_jobs,
title = "Number of jobs for college-educated workers", opacity = 0.7)